package com.example.first_android

import android.os.Bundle
import android.view.View
import android.widget.Toast
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat

class ClickEvent : AppCompatActivity(),View.OnClickListener {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_click_event)
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }
        val btn=findViewById<View>(R.id.btn2)
        btn.setOnClickListener{
            Toast.makeText(this, "IS", Toast.LENGTH_SHORT).show()
        }
        val btn3=findViewById<View>(R.id.btn3)
        btn3.setOnClickListener(this)
    }
    fun click1(view:View) {
        Toast.makeText(this, "ZJH", Toast.LENGTH_SHORT).show()
    }
    override fun onClick(v: View?) {
        when(v?.id){
        R.id.btn3-> Toast.makeText(this, "DSP", Toast.LENGTH_SHORT).show()

        }
    }
}